package nancal.mp.client.iam


import nbcp.base.comm.JsonResult
import nbcp.http.HttpClient
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.PostMapping
import org.springframework.web.bind.annotation.RequestParam

@HttpClient("mp-iam-admin-api")
interface IamAdminApiTokenClient {
    @GetMapping("/hi")
    fun hi(): String

    @PostMapping("/sys/api-token/load-app")
    fun loadAppToRedis(
        @RequestParam appCode: String
    ): JsonResult
//    {
//        var host = getHostAndIp(serviceName);
//
//        var http = HttpInvoke()("http://${host.ip}:${host.port}?appCode=${appCode}")
//
//        var retString = http.doPost()
//        if (http.status != 200) {
//            throw RuntimeException("load-app 出错: ${http.msg}!")
//        }
//
//        return retString.FromJson<JsonResult>()!!.msg.isEmpty()
//    }

    @PostMapping("/sys/api-token/load-tenant")
    fun loadTenantToRedis(
        @RequestParam tenantId: String
    ): Boolean
//    {
//        var host = getHostAndIp(serviceName);
//
//        var http = HttpInvoke()("http://${host.ip}:${host.port}?tenantId=${tenantId}")
//
//        var retString = http.doPost()
//        if (http.status != 200) {
//            throw RuntimeException("load-tenant 出错: ${http.msg}!")
//        }
//        return retString.FromJson<JsonResult>()!!.msg.isEmpty()
//    }
}